package codeGen.core;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import codeGen.core.model.TableModel;

public class MapperGen {
    public static void genCode(TableModel tModel, File output) {
        try {
            File mapper_xml = new File(output, tModel.getToClassName() + "Mapper.xml");
            File mapper_class = new File(output, tModel.getToClassName() + "Mapper.java");
            FreemarkerUtil.genResource("mapper_xml.ftl", new FileOutputStream(mapper_xml), tModel);
            FreemarkerUtil.genResource("mapper_class.ftl", new FileOutputStream(mapper_class), tModel);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}
